{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This notebook was inspired by [Plottting with XPlot](https://github.com/dotnet/interactive/blob/master/NotebookExamples/fsharp/Docs/Plotting%20with%20Xplot.ipynb)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "open XPlot.Plotly"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div id=\"401733f6-77ba-44c5-bb00-14b2beb80964\" style=\"width: 900px; height: 500px;\"></div>\r\n",
       "<script type=\"text/javascript\">\r\n",
       "\r\n",
       "var renderPlotly = function() {\r\n",
       "    var xplotRequire = requirejs.config({context:'xplot-3.0.1',paths:{plotly:'https://cdn.plot.ly/plotly-1.49.2.min'}});\r\n",
       "    xplotRequire(['plotly'], function(Plotly) {\r\n",
       "\n",
       "            var data = [{\"type\":\"bar\",\"x\":[\"A\",\"B\",\"C\"],\"y\":[1,3,2],\"name\":\"Bar 1\"}];\n",
       "            var layout = {\"title\":\"A sample bar plot\"};\n",
       "            Plotly.newPlot('401733f6-77ba-44c5-bb00-14b2beb80964', data, layout);\n",
       "        \r\n",
       "});\r\n",
       "};\r\n",
       "if ((typeof(requirejs) !==  typeof(Function)) || (typeof(requirejs.config) !== typeof(Function))) { \r\n",
       "    var script = document.createElement(\"script\"); \r\n",
       "    script.setAttribute(\"src\", \"https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js\"); \r\n",
       "    script.onload = function(){\r\n",
       "        renderPlotly();\r\n",
       "    };\r\n",
       "    document.getElementsByTagName(\"head\")[0].appendChild(script); \r\n",
       "}\r\n",
       "else {\r\n",
       "    renderPlotly();\r\n",
       "}\r\n",
       "</script>\r\n"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "let bar =\n",
    "    Bar(\n",
    "        name = \"Bar 1\",\n",
    "        x = [\"A\"; \"B\"; \"C\"],\n",
    "        y = [1; 3; 2])\n",
    "\n",
    "[bar]\n",
    "|> Chart.Plot\n",
    "|> Chart.WithTitle \"A sample bar plot\""
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".NET (F#)",
   "language": "F#",
   "name": ".net-fsharp"
  },
  "language_info": {
   "file_extension": ".fs",
   "mimetype": "text/x-fsharp",
   "name": "C#",
   "pygments_lexer": "fsharp",
   "version": "4.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
